suppressPackageStartupMessages({
library(ggplot2)
library(dplyr)
requireNamespace("plotly")
})
plotter <- function(df) {
df %>%
with({
plotly::plot_ly() %>%
plotly::add_markers(
x = x, y = y, z = z,
color = group
)
})
}
randu %>%
ggplot(aes(x = x, y = y)) + geom_point()
randu %>%
mutate(group = (1:nrow(.)) %% 3) %>%
plotter()
randu %>%
mutate(group = (1:nrow(.)) %% 3) %>%
plotter()